package com.myFwk.threadPool;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

import java.util.Iterator;

/**主要测试当时是否注入到容器当中
 * @author GL
 * @version 1.0
 * @date 2021/10/17 16:29
 */
@Slf4j
@Component
public class CheckContainer implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        Iterator<String> beanNamesIterator = beanFactory.getBeanNamesIterator();
        while (beanNamesIterator.hasNext()){
            String next = beanNamesIterator.next();
            if(next.contains("threadPoolExecutor")){
                log.info("===================");
                log.info("获取去容器内部类：{}",next);
                log.info("===================");
            }

        }

    }
}
